<template>
	<view class="content">
		<u--form
			labelPosition="left"
			:model="form"
			:rules="rules"
			ref="uForm"
			labelWidth="100"
		>
			<u-form-item
				label="保险公司"
				prop="form.name"
				borderBottom
				required
				@click="openDetail('/pages/insure/search')"
			>
				<u--input
					v-model="form.name"
					border="none"
					placeholder="请选择保险公司"
					:customStyle="{fontSize: '28rpx'}"
				>
				</u--input>
				<u-icon
					slot="right"
					name="arrow-right"
				></u-icon>
			</u-form-item>
			<u-form-item
				label="子分类"
				prop="form.type"
				borderBottom
			>
				<u-radio-group
				    v-model="form.type"
				>
					<view class="u-flex u-flex-wrap">
						<view
							style="flex: 0 0 50%;"
							class="u-p-t-10 u-p-b-10"
							v-for="(item, index) in actions"
							:key="index">
							<u-radio
								:label="item.name"
								:name="item.name"
							>
							</u-radio>
						</view>
					</view>
				</u-radio-group>
			</u-form-item>
			<u-form-item
				label="交强返点率"
				prop="form.jqPoint"
				borderBottom
				required
			>
				<u--input
					v-model="form.jqPoint"
					border="none"
					placeholder="请输入交强返点率"></u--input>
			</u-form-item>
			<u-form-item
				label="税金返点率"
				prop="form.taxPoint"
				borderBottom
				required
			>
				<u--input
					v-model="form.taxPoint"
					border="none"
					placeholder="请输入税金返点率"></u--input>
			</u-form-item>
			<u-form-item
				label="商业返点率"
				prop="form.busPoint"
				borderBottom
				required
			>
				<u--input
					v-model="form.busPoint"
					border="none"
					placeholder="请输入商业返点率"></u--input>
			</u-form-item>
			<u-form-item
				label="驾乘返点率"
				prop="form.drivePoint"
				borderBottom
				required
			>
				<u--input
					v-model="form.drivePoint"
					border="none"
					placeholder="请输入驾乘返点率"></u--input>
			</u-form-item>
		</u--form>
		
		<view class="btnSave">
			<u-button
				type="primary" 
				text="保存"
				color="#005aba"
				size="large"
				:customStyle="{borderRadius: '10rpx'}"
			></u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				rules: {
					'form.name': {
						type: 'string',
						required: true,
						message: '请选择保险公司',
						trigger: ['blur', 'change']
					},
					'form.jqPoint': {
						type: 'string',
						max: 1,
						required: true,
						message: '请输入交强返点率',
						trigger: ['blur', 'change']
					},
					'form.taxPoint': {
						type: 'string',
						max: 1,
						required: true,
						message: '请输入税金返点率',
						trigger: ['blur', 'change']
					},
					'form.busPoint': {
						type: 'string',
						max: 1,
						required: true,
						message: '请输入商业返点率',
						trigger: ['blur', 'change']
					},
					'form.drivePoint': {
						type: 'string',
						max: 1,
						required: true,
						message: '请输入驾乘返点率',
						trigger: ['blur', 'change']
					},
				},
				form: {
					name: ''
				},
				actions: [
					{
						name: '单交',
					},
					{
						name: '单商',
					},
					{
						name: '有驾乘',
					},
					{
						name: '无驾乘',
					},
					{
						name: '其他'
					}
				],
			}
		},
		onShow() {
			// 权限跳转
			// let date = new Date()
			// let year = date.getFullYear()
			// let month = (date.getMonth() + 1 < 10 ? '0'+ (date.getMonth() + 1) : date.getMonth() + 1)
			// let day = (date.getDate() < 10 ? '0'+ date.getDate() : date.getDate())
			// let d = year + '-' + month + '-' + day
			// if (d == '2024-01-17') {
			// 	uni.navigateTo({
			// 		url: '/pages/error/error'
			// 	})
			// }
		},
		onReady() {
		},
		methods: {
			openDetail(url) {
				uni.navigateTo({
					url
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		padding: 30rpx;
	}
	.btnSave {
		position: fixed;
		left: 30rpx;
		right: 30rpx;
		bottom: calc(var(--status-bar-height));
		z-index: 9;
	}
</style>
